import { Injectable } from "@angular/core";
import { HttpService } from "../../../common-ui/core/services/http.service";

@Injectable({
  providedIn: "root",
})
export class FileImportHttpService {
  constructor(private httpService: HttpService) {}

  // 上传文件
  uploadBase(params) {
    const url = `http://localhost:3000/api/upload/fileUploadBase`;
    return this.httpService.post(url, {}, params);
  }
  // 分片上传文件
  uploadFragment(params) {
    const url = `http://localhost:3000/api/upload/fileFragmentUpload`;
    return this.httpService.post(url, {}, params);
  }

  getImportResult(params) {
    const url = `/logcollect/api/v1/analysis_result_view/result_import`;
    return this.httpService.post(url, {}, params);
  }

  getErrorResult(params) {
    const url = `/logcollect/api/v1/analysis_result_view/result_download_txt`;
    return this.httpService.get(url, params);
  }

  // 获取当前任务id下的所有文件名列表
  getFileAllName() {
    const url = "http://localhost:3000/api/fileDownload/getFileList";
    return this.httpService.get(url, {});
  }
}
